<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /*
            Promise.allSettled  会返回哪个成功哪个失败，并且按序输出。   status 成功与失败  value 成功值  reason 失败原因
        */
        let aa = new Promise(function (reslove, reject) {
            setTimeout(function () {
                reject(1);
            }, 5000);
        });
        let bb = new Promise(function (reslove, reject) {
            setTimeout(function () {
                reslove(2);
            }, 0);
        });
        Promise.allSettled([aa, bb]).then((res) => {
            console.log(res)
            // 0: {status: "rejected", reason: 1}
            // 1: {status: "fulfilled", value: 2}
        });
    </script>

</body>

</html>